import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const Home = () => import('views/home/Home')
const About = () => import('views/about/About')
const Study = () => import('views/study/Study')
const Message = () => import('views/message/Message')
const Essay = () => import('views/essay/Essay')

const User = () => import('views/user/User')
const PersonalCenter = () => import('views/user/childComps/PersonalCenter')
const MessageCenter = () => import('views/user/childComps/MessageCenter')
const UserOption = () => import('views/user/childComps/UserOption')


const routes = [
  {
    path: '',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    path: '/about',
    component: About
  },
  {
    path: '/study',
    component: Study
  },
  {
    path: '/message',
    component: Message
  },
  {
    path: '/essay',
    name: 'essay',
    component: Essay
  },
  {
    path: '/user',
    component: User,
    children: [
      {
        path: 'pscenter',
        component: PersonalCenter
      },
      {
        path: 'mscenter',
        component: MessageCenter
      },
      {
        path: 'option',
        component: UserOption
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'hash',
  routes
})

export default router
